package name.hankc.spring.bean.complexfield;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import name.hankc.spring.bean.complexfield.Cat;

@Component
public class Person2 {

  @Value("#{new String[] {'张三', '张仨'}}")
  private String[] names;

  @Value("#{{'333333', '3333', '33'}}")
  private List<String> tels;

  // 引用现有的Bean，以及创建新的Bean
  @Value("#{{@miaomiao, new name.hankc.spring.bean.complexfield.Cat()}}")
  private Set<Cat> cats;

  @Value("#{{'喵喵': @miaomiao.name, '猫猫': new name.hankc.spring.bean.complexfield.Cat().name}}")
  private Map<String, Object> events;

  @Value("#{{'123': '牵着手', '456': '抬起头', '789': '我们私奔到月球'}}")
  private Properties props;

  public String[] getNames() {
    return names;
  }

  public void setNames(String[] names) {
    this.names = names;
  }

  public List<String> getTels() {
    return tels;
  }

  public void setTels(List<String> tels) {
    this.tels = tels;
  }

  public Set<Cat> getCats() {
    return cats;
  }

  public void setCats(Set<Cat> cats) {
    this.cats = cats;
  }

  public Map<String, Object> getEvents() {
    return events;
  }

  public void setEvents(Map<String, Object> events) {
    this.events = events;
  }

  public Properties getProps() {
    return props;
  }

  public void setProps(Properties props) {
    this.props = props;
  }

  @Override
  public String toString() {
    return "Person [cats=" + cats + ", events=" + events + ", names=" + Arrays.toString(names) + ", props=" + props
        + ", tels=" + tels + "]";
  }
}
